package din

import (
	"iris-wms/common/model"
)

// ----------------------------------------------- admin user
type AdminUserIn struct {
	model.AdminUser
	Roles []uint `json:"roles" gorm:"-"`
}

func (AdminUserIn) TableName() string {
	return "admin_user"
}

type AdminUserLoginForm struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type ResetPassword struct {
	ID uint `json:"ID"`
	// PasswordOld string `json:"passwordOld"`
	PasswordNew string `json:"passwordNew"`
}

type AdminUserTableIn struct {
	VxeTableIn
	Word   string `json:"word"`
	Enable int8   `json:"enable"`
}

// ----------------------------------------------- admin role
type AdminRoleTableIn struct {
	VxeTableIn
	Word   string `json:"word"`
	Enable int8   `json:"enable"`
}

type AdminRoleGrant struct {
	Rid     uint   `json:"rid"`
	PidList []uint `json:"pidList"`
	MidList []Mid  `json:"midList"`
}

type Mid struct {
	ID  uint   `json:"ID"`
	Bid []uint `json:"bid"`
}
type GrantListIn struct {
	VxeTableIn
	UserId uint `json:"userId"`
	Status uint `json:"status"`
}

// ----------------------------------------------- admin menu
type AdminMenuIn struct {
	model.AdminMenu
	Meta    model.AdminMenuMeta `json:"meta" gorm:"foreignKey:MetaId;"`
	BidList []uint              `json:"bidList" gorm:"-"`
}

func (AdminMenuIn) TableName() string {
	return "admin_menu"
}

// ----------------------------------------------- admin policy
type AdminPolicyTableIn struct {
	VxeTableIn
	Word string `json:"word"`
}
type AdminPolicyOfLogIn struct {
	Operation bool   `json:"operation"` // 1=记录 其他不记录
	IdList    []uint `json:"idList"`
}

// ----------------------------------------------- admin log
type LogIn struct {
	VxeTableIn
	UserId    uint   `json:"userId"`
	GroupName string `json:"groupName"`
	Name      string `json:"ame"`
}

// ----------------------------------------------- admin log
type AdminDictTableIn struct {
	VxeTableIn
	Word string `json:"word"`
}
